import request from '@/utils/request'

/**
 * 用户登录
 * @param {Object} data - { username, password }
 */
export function login(data) {
  return request({
    url: '/users/login',
    method: 'post',
    data
  })
}

/**
 * 用户注册
 * @param {Object} data - { username, password, image_url }
 */
export function register(data) {
  return request({
    url: '/users/register',
    method: 'post',
    data
  })
}

/**
 * 刷新 Token
 * @param {Object} data - { refresh_token }
 */
export function refreshToken(data) {
  return request({
    url: '/users/refresh',
    method: 'post',
    data
  })
}

/**
 * 获取钉钉登录 URL
 */
export function getDingtalkLoginUrl() {
  return request({
    url: '/users/dingtalklogin',
    method: 'get'
  })
}

